In Teletype, seek over unknown instead of allocating, reading, and tossing.
authorRobert Lipe <robertlipe@gpsbabel.org>
Sun, 8 Dec 2019 05:54:45 +0000 (23:54 -0600)
committerRobert Lipe <robertlipe@gpsbabel.org>
Sun, 8 Dec 2019 05:54:45 +0000 (23:54 -0600)
teletype.cc

index 4646065332385064e08afc13ff272506d6230fdd..03d5214ac79419090d6e8b7d64fb6319f7917bbe 100644 (file)
@@ -70,19 +70,11 @@ teletype_read()
 
     if (true) {  // need bit value of NEWFORMAT
       int len = gbfgetuint16(fin);
-      // probably could treat as a pascal string
-      char* junk = (char*) xmalloc(len);
-      gbfread(junk, len, 1, fin);
-      xfree(junk);
+      gbfseek(fin, len, SEEK_CUR);
     }
     wpt->latitude = gbfgetint32(fin) / 1000000.0 ;
     wpt->longitude = gbfgetint32(fin) / 1000000.0 ;
-
-    {
-      char jibberish[21];
-      gbfread(jibberish, sizeof(jibberish), 1, fin);
-    }
-
+    gbfseek(fin, 21, SEEK_CUR);
 
     waypt_add(wpt);
   }